/**
 * 
 */
package com.neusoft.classses;

import java.util.InputMismatchException;
import java.util.Scanner;

/**
 * 控制语句
 * @author LYW
 *
 */
public class ControllingExecution {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// 
		//String out = new String(testIf());
		//System.out.println(out);
		testSwich();
	}
	
	
	
	
	private static void testSwich() {
		
		String string = new String("wq");
		
		switch (string) {
		case "wq":
			System.out.println("string is " + string);
			break;

		default:
			System.out.println("default");
			break;
		}
		
	}
	
	private static void testIf01() {
		//variable for input numbers
		int iValue01 = 0;
		int iValue02=0;
		//scanner 
		Scanner sc =new Scanner(System.in);
		//input 1
		System.out.println("input the first number:");
		iValue01=sc.nextInt();
		System.out.println("The number you input is"+iValue01);
		//input 2
		System.out.println("input the second number:");
		iValue02=sc.nextInt();
		System.out.println("The number you input is"+iValue02);
		
		if(iValue01>iValue02) {
			System.out.println(iValue01 +"is bigger than"+ iValue02);
		}else {
			System.out.println(iValue02 +"is bigger than"+ iValue01);
		}
	}
	
	
	
	
	
	private static String testIf() {
		int iValue01 = 0;
		int iValue02=0;
		//input two numbers
		try {
				iValue01 = inputScan();
				System.out.println("The number you input is"+iValue01);
				iValue02 = inputScan();
				System.out.println("The number you input is"+iValue02);
				if(iValue01 >iValue02) {
					System.out.println(iValue01+">"+iValue02);
				}else if(iValue01 <iValue02){
					System.out.println(iValue01+"<"+iValue02);
				}else {
					System.out.println(iValue01+"="+iValue02);
				}
				return "perfact!";
			} catch (Exception e) {
				// TODO: handle exception
				System.out.println("输入错误,退出");
				//e.getCause() 和 e.getMessage()的结果都为Null
				//System.out.println(e.getCause());
				return "error!";
			}
		
			//if
			
				
			
		}	
		
		
		
		
	
	//这个方法不在同一个包里，这次先考过来用，下次希望能直接调用
	static int inputScan() throws InputMismatchException {
		// 接收整数的变量
		int inumScan = 0;
		Scanner scanNo = new Scanner(System.in);
		while (true) {
			System.out.println("请输入一个0-1000的整数");
			inumScan = scanNo.nextInt();
			
			if (inumScan <= 1000) {
				break;
			}

		}
		return inumScan;

	}

}
